<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,minimum-scale=1,maximum-scale=1,user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Vue-demo</title>
</head>

<body>
    <div id="app">
        <my-header>
            
        </my-header>
        
    </div>
    <div id="sub">
        <!-- <sub-header></sub-header> -->
    </div>
    <script src="./libs/vue.js"></script>
    <script>
        //定义组件选项对象
        const subOptions={
            template:`<h3>副标题</h3>`
        }
        const options={
            template:`
            <div>
                <h1>自定义组件</h1>
                <sub-header></sub-header>
            </div>
            `,
            components:{
                'sub-header':subOptions
            }
        }
       
        //全局组测组件
        Vue.component('MyHeader',options)

        const vm=new Vue({
            el:'#app',
            data:{
                message:'hello'
            }
        })
        new Vue({
            el:'#sub'
        })
    </script>
</body>

</html>